
/**
 * 二维码
 */
(function(hybrid){

    /**
     * @param {*} options 参数
     * @param {Function} callback
     */
    hybrid.plugin.QRCode = {
        scan: function(options, callback){
            options = hybrid.utils.extend({
                //title: "扫码",
                //label: "请将二维码对准框内容"
            }, options);
            hybrid.callAction('QRCode/Scan', options, function(result){
                typeof callback === 'function' && callback(result.status, result.data);
            });
        },
        /**
         *
         * @param params
         * @param callback
         */
        generator: function(params, callback){
            params = hybrid.utils.extend({
                margin: 3,
                text: "",
                size: 100
            }, params);
            hybrid.callAction('QRCode/Generator', params, function(result){
                typeof callback === 'function' && callback(result.status, result.data);
            });
        },
        /**
         *
         * @param url
         * @param callback
         */
        parse: function(url, callback){
            hybrid.callAction('QRCode/ParserImage', {
                url: url
            }, function(result){
                typeof callback === 'function' && callback(result.status, result.data);
            });
        }
    };

})(Hybrid || {});

